The simplest list is Nil, the empty list which we have been writing
[ ].
The other possible list is Cons~x~xs, which has head x and tail xs.
Every list can be constructed using these functions.
The list [1, 2, 3] is #math124#Cons~1~(Cons~2~(Cons~3~Nil )), and the
list #math125#[a, a, a,…] is Stream~a where Stream is defined:
#math126#
Stream~a |
= |
Cons~a~(Stream~a) |
|
There's even at least one application for infinite lists,
as we'll see in Section~#outputroutines#241>.
The singleton list [a] is #math127#Singleton~a, defined as:
These all have straightforward TEX definitions.
=TeXcode